<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>水果蔬菜查询</title>
    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/index.css">

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-3.3.1.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <!--导入布局js，共享header和footer-->
    <script type="text/javascript" src="js/include.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script>
        $.get("F&M_FindAllServlet",{},function (data) {
            var allS = "";
            //[{cid:1,cname:国内游},{},{}]
            for (var i = 0; i < data.length; i++) {
                    allS = "<tr>\n" +
                    "            <td>"+data[i].id+"</td>\n" +
                    "            <td>"+data[i].name+"</td>\n" +
                    "            <td>"+data[i].amount+"</td>\n" +
                    "            <td>"+data[i].price+"</td>\n" +
                    "            <td>"+data[i].productionDate+"</td>\n" +
                    "            <td>"+data[i].shelflife+"</td>\n" +
                    "            <td>"+data[i].manufacturer+"</td>\n" +
                    "            <td>"+data[i].phone+"</td>\n" +
                    "        </tr>"


                $("#FindAllFandV").append(allS)
            }


            //拼接收藏排行榜的li,<li><a href="favoriterank.html">收藏排行榜</a></li>


            //将lis字符串，设置到ul的html内容中
            $("#FindAllFandV1").html(allS);

            //添加绑定单击事件
            $("#tianjia").click(function () {
                location.href="F&Mtianjia.html";
            })

            //点击事件传递地址和值
            $("#asd").click(function () {
                //线路名称
                var rname = $("#search_input").val();
                /*location.href="F&Vtianjia.html";*/
                /*var cid = getParameter("cid");*/
                // 跳转路径 http://localhost/travel/route_list.html?cid=5，拼接上rname=xxx
                location.href="M_mohuchaxun.html?rname="+rname/*http://localhost/travel/芒*/;
            })


        });
    </script>
</head>
<body>
<div id="header"></div>
<div style="width: 1000px ;margin: 15px auto">
    <form class="form-inline">
        <div>
            <label style="float: left" for="search_input">按名称查询：</label>
            <input style="float: left" type="text" name="search_input"  class="form-control" id="search_input" placeholder="如：苹果">
        </div>
    </form>
    <button  id="asd" type="submit" class="btn btn-default">按名称查询商品</button>
</div>
<div style="width: 150px ;margin: 15px auto">
    <button id="tianjia" style="margin-top: auto;width: 150px" type="submit" class="btn btn-primary">产品添加</button>
</div>
<div style="width: 1200px ;margin: 15px auto" >
    <table id="FindAllFandV" class="table table-bordered"width="400">
        <tr>
            <th>编号</th>
            <th>商品名称</th>
            <th>数量(kg)</th>
            <th>价格(元)/kg</th>
            <th>生产日期</th>
            <th>保质期(天)</th>
            <th>供货商</th>
            <th>电话号码</th>
        </tr>
        <tr >
            <!--<td>编号</td>
            <td>商品名称</td>
            <td>数量</td>
            <td>价格</td>
            <td>生产日期</td>
            <td>保质期</td>
            <td>供货商</td>
            <td>电话号码</td>-->
        </tr>
    </table>

</div>
</body>
</html>